import request from '@/utils/request'

// export function loginByUsername(username, password) {
//   const data = {
//     username,
//     password
//   }
//   return request({
//     url: '/login/login',
//     method: 'post',
//     data
//   })
// }
// 'grant_type' => 'password',
//   'client_id' => 'client-id',
//   'client_secret' => 'client-secret',
//   'username' => 'taylor@laravel.com',
//   'password' => 'my-password',
//   'scope' => '',

export function loginByUsername(username, password) {
  const data = {
    username,
    password,
    'grant_type': 'password',
    'client_id': '2',
    'client_secret': 'qodBNeBVjTP4Klc5uNp4N82d1b8yP50TEpZv3AYI',
    'scope': '*'
  }
  return request({
    url: '/oauth/token',
    method: 'post',
    data
  })
}
export function getUserInfoByToken() {
  return request({
    url: '/user',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo() {
  return request({
    url: '/api/user',
    method: 'get'
  })
}

